﻿using System;
using System.Collections.Generic;
using System.Text;

namespace gChartSharp
{
    public class BarStyleParam : IRenderable
    {
        public string Name { get { return "chbh"; } }


        /// <summary>
        /// Bar width in pixels
        /// </summary>
        public int BarWidth { get; set; }


        /// <summary>
        /// Space between bars in pixels
        /// </summary>
        public int? SpaceBetweenBars { get; set; }


        /// <summary>
        /// Space between bar groups in pixels
        /// </summary>
        public int? SpaceBetweenBarGroups { get; set; }
               
        
        /// <summary>
        /// Render the text of the API
        /// </summary>
        /// <returns></returns>
        public string Render()
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("&{0}={1}", Name, BarWidth);

            if (this.SpaceBetweenBars != null)
                sb.AppendFormat(",{0}", SpaceBetweenBars);

            if (this.SpaceBetweenBarGroups != null)
                sb.AppendFormat(",{0}", SpaceBetweenBarGroups);

            return sb.ToString();
        }
    }
}
